home *** CD-ROM | disk | FTP | other *** search
- Path: news.uh.edu!usenet
- From: Sensarn <txs53132@bayou.uh.edu>
- Newsgroups: comp.lang.c++
- Subject: Re: Joystick
- Date: 13 Jan 1996 01:00:30 GMT
- Organization: AEtna Insurance Agency
- Message-ID: <4d707e$bc2@masala.cc.uh.edu>
- References: <4d48d3$23rm@holly.ACNS.ColoState.EDU>
- NNTP-Posting-Host: sip-14270.public-dialups.uh.edu
- Mime-Version: 1.0
- Content-Type: text/plain; charset=us-ascii
- Content-Transfer-Encoding: 7bit
- X-Mailer: Mozilla 1.1 (Windows; U; 16bit)
-
- I/O port 201h:
-
- bit definition
-
- 0 Joystick 1 -- x axis
-
- 1 Joystick 1 -- y axis
-
- 2 Joystick 2 -- x axis
-
- 3 Joystick 2 -- y axis
-
- 4 Joystick 1 -- 1st button
-
- 5 Joystick 1 -- 2nd button
-
- 6 Joystick 2 -- 1st button
-
- 7 Joystick 2 -- 2nd button
-
- It all fits into one char! If you want positions, use BIOS:
-
- Interrupt 15h
-
- subfunction in out
-
- 0 ah:84h dx:0 al:button state //Switch status
-
- 1 ah:84h dx:1h ax:joystick 1 -- x axis
- bx:joystick 1 -- y axis
- cx:joystick 2 -- x axis
- dx:joystick 2 -- y axis
-
- bitmasks for button status
-
- #define button_1_1 0x10
- #define button_1_2 0x20
- #define button_2_1 0x40
- #define button_2_2 0x80
-
- If you are using an if(button...), you must invert the button status:
-
- return((~outregs.h.al) & button); //Uses BIOS
-
- Where button is any of the bitmasks.
-
- Please notice that this information came from Teach Yourself Game
- Programming in 21 Days.
-
- Steven Sensarn - txs53132@bayou.uh.edu
-
-
-